package com.hopedove.tempdemo.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.hopedove.tempdemo.net.NoticeItem
import com.hopedove.tempdemo.net.SoapApi
import com.hopedove.tempdemo.repository.Repository
import com.hopedove.viewmodel.BaseViewModel
import kotlinx.coroutines.launch

class NoticeListViewModel(private val api: SoapApi = SoapApi()) : BaseViewModel() {

    private val _list = MutableLiveData<List<NoticeItem>>()
    val list: LiveData<List<NoticeItem>> = _list

    override fun load() = viewModelScope.launch {
        _loading.value = true
        val list = Repository.getNoticeList()
        _list.value = list
        _loading.value = false
    }


}